package cn.shengongying.service.impl;

import cn.shengongying.dao.BossOrderMapper;
import cn.shengongying.model.BossOrder;
import cn.shengongying.service.IBossOrderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 雇主订单信息 服务实现类
 * </p>
 *
 * @author RXK
 * @since 2022-01-05
 */
@Service
public class BossOrderServiceImpl extends ServiceImpl<BossOrderMapper, BossOrder> implements IBossOrderService {

    private final BossOrderMapper orderMapper;

    public BossOrderServiceImpl(BossOrderMapper orderMapper) {
        this.orderMapper = orderMapper;
    }

    @Override
    public void logicDelete(Long id) {
        orderMapper.logicDelete(id);
    }

    @Override
    public List<BossOrder> pageList(Long userId, Integer offset, Integer pageSize) {
        return orderMapper.pageList(userId,offset,pageSize);
    }

    @Override
    public void updateStatus(Long orderId, int status) {
        BossOrder order = new BossOrder();
        order.setId(orderId);
        order.setStatus(status);
        orderMapper.updateById(order);
    }

    @Override
    public BossOrder findByOrderNo(String orderNo) {
        return orderMapper.findByOrderNo(orderNo);
    }

    @Override
    public void updateInvoiceStatus(Long id, int invoiceStatus) {
        BossOrder order = new BossOrder();
        order.setId(id);
        order.setInvoiceStatus(invoiceStatus);
        orderMapper.updateById(order);
    }

    @Override
    public List<BossOrder> listAndPage(int start, int length) {
        return orderMapper.listAndPage(start,length);
    }

    @Override
    public long countRefundOrder() {
        return orderMapper.countRefundOrder();
    }

    @Override
    public void updateRefundInfo(BossOrder bossOrder) {
        orderMapper.updateRefundInfo(bossOrder);
    }

    @Override
    public void updateByOrderNo(String outTradeNo, int status, Date successDate) {
        orderMapper.updateByOrderNo(outTradeNo,status,successDate);
    }

    @Override
    public List<BossOrder> findInvoiceList(int start, int length) {
        return orderMapper.findInvoiceList(start,length);
    }

    @Override
    public long countInvoice() {
        return orderMapper.countInvoice();
    }

}
